//
//  TTQualityCheckViewCell.m
//  TaoTuo
//
//  Created by 周晨晔 on 2019/9/25.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTQualityCheckViewCell.h"

@interface TTQualityCheckViewCell ()
@property (weak, nonatomic) IBOutlet UIButton *selectBtn;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;

@end

@implementation TTQualityCheckViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.bgView.frame = CGRectMake(10, 5, SCREEN_WIDTH - 40 - 20, 50);
    self.backgroundColor = [UIColor whiteColor];
    self.bgView.backgroundColor = [UIColor whiteColor];
    self.bgView.layer.cornerRadius = 5;
    self.bgView.layer.shadowColor = kMainColor.CGColor;
    self.bgView.layer.shadowOffset = CGSizeZero;
    self.bgView.layer.shadowOpacity = 0.2;
    self.bgView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds cornerRadius:5].CGPath;
    
}



- (IBAction)clickSelectBtn:(UIButton *)sender {
    
    if (sender.selected) {
        return;
    }
    sender.selected = YES;
    self.model.isSelect = sender.selected;
    if (self.chooseBlock) {
        self.chooseBlock(self.model);
    }
}

- (void)setModel:(TTQualityCheckModel *)model
{
    _model = model;
    
    self.titleLabel.text = model.CertTypeName;
    self.infoLabel.text = model.CertTypeDescript;
    NSString *priceStr = [NSString stringWithFormat:@"收费标准 ￥%@", model.Price];
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:priceStr];
    [attr addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:10], NSForegroundColorAttributeName : UIColorHex(999999)} range:[priceStr rangeOfString:@"收费标准"]];
    self.priceLabel.attributedText = attr;
    
    self.selectBtn.selected = model.isSelect;
    
}


@end
